<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
	<title>模板管理器</title>
	<link rel="stylesheet" href="../static/css/bootstrap.min.css">
	<link href="../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
	<link href="css/base.css" rel="stylesheet" type="text/css" />
	<style type="text/css">
		.linerow {
			border-bottom: 1px solid #CBD8AC;
		}

		td {
			padding-left: 5px;
		}

		a.btn {
			color: white!important;
		}
	</style>
	<script language="javascript">
		function DelTpl(filename) {
			if (window.confirm('你确定要删除这篇文档吗?')) location = 'tpl.php?action=del&acdir=<?php echo $acdir; ?>&filename=' + filename;
			else return false;
		}
	</script>
</head>

<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
	<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6"
		class="table maintable table-bordered mt-3">
		<tr>
			<td height="28" background="images/tbg.gif" colspan="7">
				<b>模板管理</b>
			</td>
		</tr>
	</table>
	<table width='98%' border='0' cellspacing='1' cellpadding='0' align="center" bgcolor="#cfcfcf" class="table maintable table-bordered">
		<tr height="26" align="center">
			<td width="25%" background="images/wbg.gif"><strong>文件名</strong></td>
			<td width="33%" background="images/wbg.gif"><strong>文件描述</strong></td>
			<td width="22%" background="images/wbg.gif"><strong>修改时间</strong></td>
			<td width="20%" background="images/wbg.gif"><strong>操作</strong></td>
		</tr>
		<tr>
			<td colspan='4' height="28" bgcolor="#F9FCEF">
				<div style='float:left'>
					<b>
						当前位置：
						<?php
      		if($acdir=='plus') echo '插件模板';
      		else if($acdir=='system') echo '底层模板';
      		else echo '核心模板 &gt; '.$acdir;
      		?>
					</b>
				</div>
				<div style='float:right;padding-right:10px'>
					<a class="btn btn-secondary btn-sm" href='templets_main.php'>默认模板目录</a>
					<a class="btn btn-secondary btn-sm" href='templets_main.php?acdir=plus'>插件模板目录</a>
				</div>
			</td>
		</tr>
		<?php
   $dh = dir($templetdird);
   while($filename=$dh->read())
   {
   	  if(!preg_match("#\.htm#", $filename)) continue;
   	  $filetime = filemtime($templetdird.'/'.$filename);
      $filetime = MyDate("Y-m-d H:i",$filetime);
      $fileinfo = (isset($fileinfos[$filename]) ? $fileinfos[$filename] : '未知模板');
   ?>
		<tr height="26" bgcolor='#FFFFFF' onMouseMove="javascript:this.bgColor='#FCFDEE';"
			onMouseOut="javascript:this.bgColor='#FFFFFF';">
			<td>
				<a href='<?php echo $templeturld.'/'.$filename; ?>' target='_blank'>
					<img src='images/htm.gif' border='0' align='absmiddle' /> <?php echo $filename; ?>
				</a>
			</td>
			<td>
				<?php echo $fileinfo; ?>
			</td>
			<td align='center'>
				<?php echo $filetime; ?>
			</td>
			<td align='center'>
				<a class="btn btn-secondary btn-sm" href='tpl.php?action=edit&acdir=<?php echo $acdir; ?>&filename=<?php echo $filename; ?>' title="编辑"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
				<?php
			if(!isset($fileinfos[$filename]))
			{
			?>
				|
				<a href='#' class="btn btn-secondary btn-sm" onClick="javascript:DelTpl('<?php echo $filename; ?>');" title="删除"><i class="fa fa-trash" aria-hidden="true"></i></a>
				<?php
		   }
			?>
			</td>
		</tr>
		<?php } ?>
		<tr>
			<td colspan="4" height='32' bgcolor="#F9FCEF">
				&nbsp;
				<a class="btn btn-secondary" href='tpl.php?action=newfile&acdir=<?php echo $acdir; ?>'>新建模板</a>
				&nbsp;
				<a class="btn btn-secondary" href='tpl.php?action=upload&acdir=<?php echo $acdir; ?>'>上传模板</a>
			</td>
		</tr>
	</table>

</body>

</html>